package com.huang.array;

/**
 * 目标：
 * 数组遍历-求和
 */
public class Demo4_Array {
    public static void main(String[] args) {
        int[] arr = {10, 20, 30, 40};
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            sum = sum + arr[i];
        }
        System.out.println("总和为：" + sum);
    }
}